﻿<controls:ChildWindow x:Class="RIA.NTiersApp.Views.PruductUI.ProductDetailsWindow"
           xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
           xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
           xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"
           Width="500" Height="560" 
           Title="ProductDetailsWindow" mc:Ignorable="d" 
                      xmlns:vm="clr-namespace:RIA.ViewModel;assembly=RIA.ViewModel"
                      xmlns:riaControls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.DomainServices"
                      xmlns:my="clr-namespace:RIA.ServicesLibrary.Web.Services;assembly=RIA.ServicesLibrary" 
                      xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
                      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
                      xmlns:my1="clr-namespace:RIA.DAL;assembly=RIA.ServicesLibrary" 
                      xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"
                      xmlns:caches="clr-namespace:RIA.NTiersApp.Globals" xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit">
    <controls:ChildWindow.Resources>
        <caches:ListCaches x:Key="listCaches"></caches:ListCaches>
    </controls:ChildWindow.Resources>
    
    <controls:ChildWindow.DataContext>
        <vm:ProductDetailsViewModel>
        </vm:ProductDetailsViewModel>
    </controls:ChildWindow.DataContext>
    <Grid>
        <toolkit:BusyIndicator     HorizontalAlignment="Left" IsBusy="{Binding IsBusy}"  Margin="5" Name="busyIndicator1" VerticalAlignment="Top">
            <Grid x:Name="LayoutRoot" Margin="2" Height="493">
            <Grid.RowDefinitions>
                <RowDefinition Height="431*" />
                <RowDefinition Height="62" />
            </Grid.RowDefinitions>

            <Button x:Name="CancelButton" Content="Cancel" Click="CancelButton_Click" Width="75" Height="23" HorizontalAlignment="Right" Margin="0,12,0,0" Grid.Row="1" />
            <Button x:Name="OKButton" Content="Save" Click="OKButton_Click" Height="23" Margin="324,12,79,0" Grid.Row="1" DataContext="{Binding}" Command="{Binding Path=SaveProductCommand}" />

            <Grid DataContext="{Binding  Path=Product}" Grid.RowSpan="2" 
              HorizontalAlignment="Left" Margin="56,14,0,0" Name="grid1" VerticalAlignment="Top"
              >
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="Auto" />
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>
                <sdk:Label Content="Color:" Grid.Column="0" Grid.Row="0" HorizontalAlignment="Left" Margin="3" VerticalAlignment="Center" />
                <TextBox Grid.Column="1" Grid.Row="0" Height="23" HorizontalAlignment="Left" Margin="3" Name="colorTextBox" Text="{Binding Path=Color, Mode=TwoWay, NotifyOnValidationError=true, ValidatesOnExceptions=true, TargetNullValue=''}" VerticalAlignment="Center" Width="120" />
                <sdk:Label Content="Discontinued Date:" Grid.Column="0" Grid.Row="1" HorizontalAlignment="Left" Margin="3" VerticalAlignment="Center" />
                <sdk:DatePicker Grid.Column="1" Grid.Row="1" Height="23" HorizontalAlignment="Left" Margin="3" Name="discontinuedDateDatePicker" SelectedDate="{Binding Path=DiscontinuedDate, Mode=TwoWay, NotifyOnValidationError=true, ValidatesOnExceptions=true, TargetNullValue=''}" VerticalAlignment="Center" Width="120" />
                <sdk:Label Content="List Price:" Grid.Column="0" Grid.Row="2" HorizontalAlignment="Left" Margin="3" VerticalAlignment="Center" />
                <TextBox Grid.Column="1" Grid.Row="2" Height="23" HorizontalAlignment="Left" Margin="3" Name="listPriceTextBox" Text="{Binding Path=ListPrice, Mode=TwoWay, NotifyOnValidationError=true, ValidatesOnExceptions=true}" VerticalAlignment="Center" Width="120" />
                <sdk:Label Content="Modified Date:" Grid.Column="0" Grid.Row="3" HorizontalAlignment="Left" Margin="3" VerticalAlignment="Center" />
                <sdk:DatePicker Grid.Column="1" Grid.Row="3" Height="23" HorizontalAlignment="Left" Margin="3" Name="modifiedDateDatePicker" SelectedDate="{Binding Path=ModifiedDate, Mode=TwoWay, NotifyOnValidationError=true, ValidatesOnExceptions=true}" VerticalAlignment="Center" Width="120" />
                <sdk:Label Content="Name:" Grid.Column="0" Grid.Row="4" HorizontalAlignment="Left" Margin="3" VerticalAlignment="Center" />
                <TextBox Grid.Column="1" Grid.Row="4" Height="23" HorizontalAlignment="Left" Margin="3" Name="nameTextBox" Text="{Binding Path=Name, Mode=TwoWay, NotifyOnValidationError=true, ValidatesOnExceptions=true, TargetNullValue=''}" VerticalAlignment="Center" Width="120" />
                <sdk:Label Content="Product Category ID:" Grid.Column="0" Grid.Row="5" HorizontalAlignment="Left" Margin="3" VerticalAlignment="Center" />
                <ComboBox 
                      Grid.Column="1" Grid.Row="5" 
                      Height="23"
                      HorizontalAlignment="Left" 
                      ItemsSource="{Binding Path=ProductCategories, Source={StaticResource listCaches }}" 
                      Margin="3" 
                      Name="productCategoryIDComboBox" 
                      VerticalAlignment="Center" Width="120" 
                                      DisplayMemberPath="Name"
                      SelectedValuePath="ProductCategoryID"
                      SelectedValue="{Binding ProductCategoryID,Mode=TwoWay}"
                      >
                    <ComboBox.ItemsPanel>
                        <ItemsPanelTemplate>
                            <VirtualizingStackPanel />
                        </ItemsPanelTemplate>
                    </ComboBox.ItemsPanel>
                </ComboBox>
                <sdk:Label Content="Product Model ID:" Grid.Column="0" Grid.Row="6" HorizontalAlignment="Left" Margin="3" VerticalAlignment="Center" />
                <ComboBox 
                      Grid.Column="1" 
                      Grid.Row="6" 
                      Height="23" 
                      HorizontalAlignment="Left" 
                      ItemsSource="{Binding Path=ProductModels, Source={StaticResource listCaches}}" 
                      Margin="3" 
                      Name="productModelIDComboBox" 
                      VerticalAlignment="Center" 
                      Width="120" 
                      SelectedValue="{Binding ProductModelID,Mode=TwoWay}"
                      DisplayMemberPath="Name"
                      SelectedValuePath="ProductModelID"
                      >
                    <ComboBox.ItemsPanel>
                        <ItemsPanelTemplate>
                            <VirtualizingStackPanel />
                        </ItemsPanelTemplate>
                    </ComboBox.ItemsPanel>
                </ComboBox>
                <sdk:Label Content="Product Number:" Grid.Column="0" Grid.Row="7" HorizontalAlignment="Left" Margin="3" VerticalAlignment="Center" />
                <TextBox Grid.Column="1" Grid.Row="7" Height="23" HorizontalAlignment="Left" Margin="3" Name="productNumberTextBox" Text="{Binding Path=ProductNumber, Mode=TwoWay, NotifyOnValidationError=true, ValidatesOnExceptions=true, TargetNullValue=''}" VerticalAlignment="Center" Width="120" />
                <sdk:Label Content="Sell End Date:" Grid.Column="0" Grid.Row="8" HorizontalAlignment="Left" Margin="3" VerticalAlignment="Center" />
                <sdk:DatePicker Grid.Column="1" Grid.Row="8" Height="23" HorizontalAlignment="Left" Margin="3" Name="sellEndDateDatePicker" SelectedDate="{Binding Path=SellEndDate, Mode=TwoWay, NotifyOnValidationError=true, ValidatesOnExceptions=true, TargetNullValue=''}" VerticalAlignment="Center" Width="120" />
                <sdk:Label Content="Sell Start Date:" Grid.Column="0" Grid.Row="9" HorizontalAlignment="Left" Margin="3" VerticalAlignment="Center" />
                <sdk:DatePicker Grid.Column="1" Grid.Row="9" Height="23" HorizontalAlignment="Left" Margin="3" Name="sellStartDateDatePicker" SelectedDate="{Binding Path=SellStartDate, Mode=TwoWay, NotifyOnValidationError=true, ValidatesOnExceptions=true}" VerticalAlignment="Center" Width="120" />
                <sdk:Label Content="Size:" Grid.Column="0" Grid.Row="10" HorizontalAlignment="Left" Margin="3" VerticalAlignment="Center" />
                <TextBox Grid.Column="1" Grid.Row="10" Height="23" HorizontalAlignment="Left" Margin="3" Name="sizeTextBox" Text="{Binding Path=Size, Mode=TwoWay, NotifyOnValidationError=true, ValidatesOnExceptions=true, TargetNullValue=''}" VerticalAlignment="Center" Width="120" />
                <sdk:Label Content="Standard Cost:" Grid.Column="0" Grid.Row="11" HorizontalAlignment="Left" Margin="3" VerticalAlignment="Center" />
                <TextBox Grid.Column="1" Grid.Row="11" Height="23" HorizontalAlignment="Left" Margin="3" Name="standardCostTextBox" Text="{Binding Path=StandardCost, Mode=TwoWay, NotifyOnValidationError=true, ValidatesOnExceptions=true}" VerticalAlignment="Center" Width="120" />
                <sdk:Label Content="Thumbnail Photo File Name:" Grid.Column="0" Grid.Row="13" HorizontalAlignment="Left" Margin="3" VerticalAlignment="Center" />
                <TextBox Grid.Column="1" Grid.Row="13" Height="23" HorizontalAlignment="Left" Margin="3" Name="thumbnailPhotoFileNameTextBox" Text="{Binding Path=ThumbnailPhotoFileName, Mode=TwoWay, NotifyOnValidationError=true, ValidatesOnExceptions=true, TargetNullValue=''}" VerticalAlignment="Center" Width="120" />
                <sdk:Label Content="Weight:" Grid.Column="0" Grid.Row="14" HorizontalAlignment="Left" Margin="3" VerticalAlignment="Center" />
                <TextBox Grid.Column="1" Grid.Row="14" Height="23" HorizontalAlignment="Left" Margin="3" Name="weightTextBox" Text="{Binding Path=Weight, Mode=TwoWay, NotifyOnValidationError=true, ValidatesOnExceptions=true, TargetNullValue=''}" VerticalAlignment="Center" Width="120" />
            </Grid>
        </Grid>
       
            
        </toolkit:BusyIndicator>
    </Grid>
    
</controls:ChildWindow>